package com.cd.springcloud.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cd.springcloud.mapper.DeptMapper;
import com.cd.springcloud.pojo.Dept;
import com.cd.springcloud.service.DeptService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author liujilong
 * @Project springcloud
 * @File DeptServiceImpl
 * @Date 2021/12/24 10:36 下午
 **/
@Service
public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements DeptService {
    @Override
    public boolean addDept(Dept dept) {
        return baseMapper.insert(dept) == 1;
    }

    @Override
    public Dept queryById(Long id) {
        return baseMapper.selectOne(new QueryWrapper<Dept>().eq("deptno", id));
    }

    @Override
    public List<Dept> queryAll() {
        return baseMapper.selectList(new QueryWrapper<>());
    }
}
